1. Technical Field
The present invention relates to an improved data processing system and in particular to a method and apparatus for optimizing performance in a data processing system. Still more particularly, the present invention provides a method and apparatus for profiling performance in a data processing system.
2. Description of Related Art
In order to improve performance of code generated by various families of computers, it is often necessary to determine where time is being spent by the processor in executing code, such efforts being commonly known in the computer processing arts as locating "hot spots". Ideally one would like to isolate such hot spots at the instruction and/or source line of code level in order to focus attention on areas which might benefit most from improvements to the code.
For example, isolating such hot spots to the instruction level permits compiler writers to find significant areas of suboptimal code generation, whereby they may thus focus their efforts to improve code generation efficiency in these areas. Another potential important use of instruction level detail is to provide guidance to the designer of future systems. Such designers with appropriate profiling tools may find characteristic code sequences and/or single instructions requiring improvement to optimize the available hardware for a given level of hardware technology.
In a like manner, isolating hot spots to the source line of code level would provide the level of detail necessary for an application developer to make algorithmic tradeoffs. A programmer's a priori guesses about where a program is spending significant time executing are frequently wrong for numerous reasons. First, the programmer seldom has a comprehensive understanding of the complex dynamics of the hardware and software system. Secondly, the compiler itself often does not generate code that corresponds to the programmer's assumptions. It was accordingly highly desirable to provide a system for feeding back information to the programmer about the execution dynamics of a program in terms that the programmer could easily understand. Various methods are present for monitoring aggregate CPU usage known as "profiling", for example, U.S. Pat. No. 5,355,487, System and Method for Computer System Profiling and "Technique for Speculatively Sampling Performance Parameters," IBM Tech. Disclosure Bull., No. 9, 589-592 (September 1994).
With the increasing use of the Internet by many businesses and individual users, Java has become an increasingly common system in which applications are disseminated. Java is an object oriented programming language and environment focusing on defining data as objects and the methods that may be applied to those objects.
The Java virtual machine (JVM) is the name of a virtual computer component that actually executes Java programs. Java programs are not run directly by the central processor, but instead by the JVM, which is itself a piece of software running on the processor. The JVM allows Java programs to be executed on a different platform as opposed to only the one platform for which the code was compiled. Java programs are compiled for the JVM. In this manner, Java is able to support applications for many types of data processing systems, which may contain a variety of central processing units and operating systems architectures. To enable a Java application to execute on different types of data processing systems, a compiler typically generates an architecture-neutral file format--the compiled code is executable on many processors, given the presence of the Java run-time system. The Java compiler generates bytecode instructions that are non-specific to a particular computer architecture. A bytecode is a machine independent code generated by the Java compiler and executed by a Java interpreter. A Java interpreter is part of the JVM that alternately decodes and interprets a bytecode or bytecodes. These bytecode instructions are designed to be easy to interpret on any computer and easily translated on the fly into native machine code. Byte codes are typically translated into native code by a just-in-time compiler or JIT.
A need has arisen with operating systems that provide implementation of the JVM to take non-invasive snapshots of these Java environments to allow for identification of various processes executing within that Java environment.
Therefore, it would be advantageous to have a method and apparatus for profiling data processing systems having Java environments.